package greentycoon.gui;

import greentycoon.batiment.centrale.*;
import greentycoon.main.VariablesGlobales;

import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;

public class FenetreSelectionCentrale extends JFrame{
	
	public FenetreSelectionCentrale(){
		//super("Centrales",false,true,false,false);
		setTitle("Centrales");
		setSize(550, 300);
	    setLocation(300, 300);
	    setVisible(false);
	    setLayout(null);
	    setAlwaysOnTop(true);


	    construire();
	}

	private void construire() {
		Container contentPane = getContentPane();
		
		/*centrale à charbon*/
		ImageIcon centraleCharbonPicture = GUI.rescaleImage(new File("src/greentycoon/gui/centraleCharbon.png"), CentraleCharbon.sizeX*VariablesGlobales.TAILLE_CASE_X, CentraleCharbon.sizeY*VariablesGlobales.TAILLE_CASE_Y);
		JButton centraleCharbonBoutton = new JButton(centraleCharbonPicture);
		centraleCharbonBoutton.setBounds(30, 15, 75, 75);
		centraleCharbonBoutton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				VariablesGlobales.choixBatiment = "centraleCharbon";
				setVisible(false);
				
			}
		});
		JLabel centraleCharbonLabel = new JLabel("<html>Centrale à Charbon<br>"+String.valueOf(CentraleCharbon.prix)+" GF</html>");
		Font f = new Font(centraleCharbonLabel.getFont().getName(), Font.BOLD, 10);
		centraleCharbonLabel.setFont(f);
		centraleCharbonLabel.setBounds(30, 85, 300, 50);	
		
		contentPane.add(centraleCharbonLabel);
		contentPane.add(centraleCharbonBoutton);
		
		/*centrale éolienne*/
		ImageIcon centraleEoliennePicture = GUI.rescaleImage(new File("src/greentycoon/gui/eolienne.png"), CentraleEolienne.sizeX*VariablesGlobales.TAILLE_CASE_X, CentraleEolienne.sizeY*VariablesGlobales.TAILLE_CASE_Y);
		JButton centraleEolienneBoutton = new JButton(centraleEoliennePicture);
		centraleEolienneBoutton.setBounds(150, 15, 75, 75);
		centraleEolienneBoutton.addActionListener(new ActionListener() {
		
			@Override
			public void actionPerformed(ActionEvent arg0) {
				VariablesGlobales.choixBatiment = "centraleEolienne";
				setVisible(false);
				
			}
		});
		JLabel centraleEolienneLabel = new JLabel("<html>Centrale Eolienne<br>"+String.valueOf(CentraleEolienne.prix)+" GF</html>");
		centraleEolienneLabel.setFont(f);
		centraleEolienneLabel.setBounds(150, 85, 300, 50);	
		
		contentPane.add(centraleEolienneLabel);
		contentPane.add(centraleEolienneBoutton);
		
		/*centrale Nucleaire*/
		ImageIcon centraleNucleairePicture = GUI.rescaleImage(new File("src/greentycoon/gui/centraleNucleaire.png"), CentraleNucleaire.sizeX*VariablesGlobales.TAILLE_CASE_X, CentraleNucleaire.sizeY*VariablesGlobales.TAILLE_CASE_Y);
		JButton centraleNucleaireBoutton = new JButton(centraleNucleairePicture);
		centraleNucleaireBoutton.setBounds(270, 15, 75, 75);
		centraleNucleaireBoutton.addActionListener(new ActionListener() {
		
			@Override
			public void actionPerformed(ActionEvent arg0) {
				VariablesGlobales.choixBatiment = "centraleNucleaire";
				setVisible(false);
				
			}
		});
		JLabel centraleNucleaireLabel = new JLabel("<html>Centrale Nucleaire<br>"+String.valueOf(CentraleNucleaire.prix)+" GF</html>");
		centraleNucleaireLabel.setFont(f);
		centraleNucleaireLabel.setBounds(270, 85, 300, 50);	
		
		contentPane.add(centraleNucleaireLabel);
		contentPane.add(centraleNucleaireBoutton);
		
		/*centrale Photovaltaïque*/
		ImageIcon centralePhotovoltaiquePicture = GUI.rescaleImage(new File("src/greentycoon/gui/centralePhotovoltaique.png"), CentralePhotovoltaique.sizeX*VariablesGlobales.TAILLE_CASE_X, CentralePhotovoltaique.sizeY*VariablesGlobales.TAILLE_CASE_Y);
		JButton centralePhotovoltaiqueBoutton = new JButton(centralePhotovoltaiquePicture);
		centralePhotovoltaiqueBoutton.setBounds(390, 15, 75, 75);
		centralePhotovoltaiqueBoutton.addActionListener(new ActionListener() {
		
			@Override
			public void actionPerformed(ActionEvent arg0) {
				VariablesGlobales.choixBatiment = "centralePhotovoltaique";
				setVisible(false);
				
			}
		});
		JLabel centralePhotovoltaiqueLabel = new JLabel("<html>Centrale Photovoltaique<br>"+String.valueOf(CentralePhotovoltaique.prix)+" GF</html>");
		centralePhotovoltaiqueLabel.setFont(f);
		centralePhotovoltaiqueLabel.setBounds(390, 85, 300, 50);	
		
		contentPane.add(centralePhotovoltaiqueLabel);
		contentPane.add(centralePhotovoltaiqueBoutton);
		
		/*Recherche et developpement*/
		ImageIcon rechercheDeveloppementPicture = GUI.rescaleImage(new File("src/greentycoon/gui/rechercheDeveloppement.png"), 40, 40);
		JButton rechercheDeveloppementButton = new JButton(rechercheDeveloppementPicture);
		rechercheDeveloppementButton.setBounds(470, 200, 55, 55);
		rechercheDeveloppementButton.setToolTipText("Recherche et Developpement");
		rechercheDeveloppementButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				VariablesGlobales.fenetreRechercheCentrale.setVisible(true);
				
			}
		});

		
		contentPane.add(rechercheDeveloppementButton);
		
	}

}
